package net.lzzy.twocarsort;

import org.apache.spark.sql.Column;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.SparkSession;
import org.apache.spark.sql.types.StructType;

public class CarSortSparkSession {
    public static void main(String[] args) {
        SparkSession ss = SparkSession.builder()
                .appName(CarSortSparkSession.class.getName())
                .master("local")
                .getOrCreate();
        Dataset<Row> csvSort = ss.read().csv("src/trip2.csv");
        Dataset<Row> rowDataset1 = csvSort.selectExpr("_c0","_c1","_c2","int(`_c3`)", "int(`_c4`)");
        Dataset<Row> rowDataset = rowDataset1.orderBy(new Column("_c3"), new Column("_c4"));
        rowDataset.show();
    }
}
